package module.building.view.buildingListPanel
{
	import code.ui.SimpleToolTips;
	
	import com.darwin.darwinUI.assist.Group;
	import com.darwin.darwinUI.assist.IGroupItem;
	import com.darwin.darwinUI.controls.Button;
	import com.darwin.darwinUI.core.UIComponent;
	import com.darwin.darwinUI.manager.UIManager;
	
	import flash.text.TextColorType;
	
	import module.building.consts.BuildConst;
	import module.main.view.ResourceConst;

	/**
	 *次级建筑选项卡的选项 
	 * @author hc
	 */
	public class SubBuildTab extends UIComponent implements IGroupItem
	{
		private var _subType:String;
		private var _group:Group;
		private var selected_tab:UIComponent;
		private var button:tabButton;
		
		public function SubBuildTab(subType:String)
		{
			super();
			_subType = subType;
			init();
		}
		
		/**
		 *分别加载“选中背景”与“前景按钮 ”
		 */
		private function init():void
		{
			this.backgroundAuto = true;
//			this.width = 60;
//			this.height = 53;
				
			selected_tab = new UIComponent();
			selected_tab.backgroundAuto = true;
			selected_tab.backgroundSkin = ResourceConst.BUILD_IMAGE_TAB_BG2;
			addChild(selected_tab);
			selected_tab.x = -9;
			selected_tab.y = -8.3;
			selected_tab.visible = false;
			
			button = new tabButton();
			addChild(button);
		}
		
		override public function onClick():void
		{
			//			trace("click ");
			if(group)
			{
				group.itemSelectActionStart(this,true);
			}
		}
		
		/**
		 * 鼠标悬停在次级选项卡上时，显示对应的分类名称
		 */
		override public function onMouseOver():void
		{
			UIManager.getToolTipManager().showTips(SimpleToolTips,this,
				BuildConst.getSubTypeName(_subType));
		}
		
		public function get group():Group
		{
			return _group;
		}
		
		public function set group(value:Group):void
		{
			_group = value;
		}
		
		
		public function set immediateSelected(value:Boolean):void
		{
			
		}
		
		public function selectAction(selected:Boolean):void
		{
			if(selected)
			{
				selected_tab.visible = true;
			}
			else
			{
				selected_tab.visible = false;
			}
			
			if(group)
			{
				group.itemSelectActionEnd(this,selected);
			}
		}
		
		public function groupSelectionChange(curruntSelection:IGroupItem):void
		{
			
		}

		public function get subType():String
		{
			return _subType;
		}

	}
}
import code.consts.FilterConst;

import com.darwin.darwinUI.controls.Button;

import flash.filters.GlowFilter;

import module.main.view.ResourceConst;

 class tabButton extends Button
{	
	public function tabButton()
	{
		super();
		init();
	}
	private function init():void
	{
		this.backgroundAuto = true;
		this.backgroundSkin = ResourceConst.BUILD_ICON_BUILD;
	}
	
	override public function onMouseOver():void
	{
		filters = [FilterConst.WHIGHT_GLOW_FILTER];
	}
	
	override public function onMouseOut():void
	{
		filters = [];
	}
}